home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 December / PCWDEC06.iso / Software / Trial / Paint Shop Pro XI / Data1.cab / _A27968B1DDDF4259ABE417F36BF479D3 < prev    next >
Encoding:
Text File  |  2006-08-04  |  16.0 KB  |  417 lines

  1. from PSPApp import *
  2.  
  3. # Copyright 2006 Corel Software Inc., all rights reserved
  4. # This file contains utility routines provided by Corel Software.
  5. # This file contains all translatable strings for the bundled script files.
  6.  
  7. ScriptData = {}
  8.  
  9. class SaveSelection:
  10.     ''' define a helper class that can save any active selection to the alpha
  11.         channel and restore it later
  12.     '''
  13.     def __init__( self, Environment, Doc ):
  14.         ''' at init time we save the environment variable provided by PSP,
  15.             and if a selection exists we save it to an alpha channel
  16.         '''
  17.         self.Env = Environment
  18.         self.SavedSelection =  '__$TempSavedSelection$__'
  19.         self.IsSaved = 0
  20.         self.SavedOnDoc = Doc
  21.         
  22.         SelResult = App.Do( self.Env, 'GetRasterSelectionRect' )
  23.         if SelResult[ 'Type' ] != App.Constants.SelectionType.None:
  24.             # if there is a selection save it to the alpha channel
  25.             App.Do( self.Env, 'SelectSaveDisk', {
  26.                 'FileName': self.SavedSelection, 
  27.                 'Overwrite': App.Constants.Boolean.true, 
  28.                 'GeneralSettings': {
  29.                     'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  30.                     'AutoActionMode': App.Constants.AutoActionMode.Match
  31.                     }
  32.                 }, Doc)
  33.             self.IsSaved = 1    # set this so we know we saved one
  34.             
  35.             if SelResult[ 'Type' ] == App.Constants.SelectionType.Floating:
  36.                 # if the selection is floating promote it to a layer
  37.                 App.Do( self.Env, 'SelectPromote', {
  38.                         'KeepSelection': App.Constants.Boolean.false, 
  39.                         'LayerName': SelectionLayer, 
  40.                         'GeneralSettings': {
  41.                             'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  42.                             'AutoActionMode': App.Constants.AutoActionMode.Match
  43.                             }
  44.                         }, Doc)
  45.             else:
  46.                 App.Do( self.Env, 'SelectNone' )
  47.            
  48.             
  49.     def RestoreSelection( self ):
  50.         ''' if we have saved a selection, restore it now.  If we promoted
  51.             a floating selection to a layer we don't restore the selection
  52.             but don't attempt to mess with the layer in any way
  53.         '''
  54.         if self.IsSaved == 1:
  55.             # load the selection back from disk - this will replace any existing selection
  56.             App.Do( self.Env, 'SelectLoadDisk', {
  57.                     'FileName': self.SavedSelection, 
  58.                     'Operation': App.Constants.SelectionOperation.Replace, 
  59.                     'UpperLeft': App.Constants.Boolean.false, 
  60.                     'ClipToCanvas': App.Constants.Boolean.false, 
  61.                     'GreyMethod': App.Constants.CreateMaskFrom.Luminance, 
  62.                     'Invert': App.Constants.Boolean.false, 
  63.                     'GeneralSettings': {
  64.                         'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  65.                         'AutoActionMode': App.Constants.AutoActionMode.Match
  66.                         }
  67.                     }, self.SavedOnDoc)
  68.  
  69.     # end class SaveSelection
  70.  
  71. def NameFromMaterial( Material, Delimiter=' ', IncludeTexture=1 ):
  72.     ''' Given a material repository, return a name that describes it.
  73.         By default the name is delimited with space, but the delimiter
  74.         parameter can be used to override it.
  75.         By default textures are included in the name, but can be omitted
  76.         by setting the IncludeTexture parameter to 0
  77.     '''
  78.     TextureName = None
  79.     TypeName = ''
  80.     if Material is None:
  81.         CoreName = Null
  82.     else:
  83.         if Material[ 'Pattern' ] and \
  84.            (Material[ 'Pattern' ][ 'Name' ] or Material[ 'Pattern' ][ 'Image' ] ):
  85.             TypeName = Pattern
  86.             if Material[ 'Pattern' ][ 'Name' ]:
  87.                 CoreName = Material[ 'Pattern'  ][ 'Name' ]
  88.             else:
  89.                 CoreName = Inline
  90.         elif Material[ 'Gradient' ] and Material[ 'Gradient' ][ 'Name' ]:
  91.             TypeName = Gradient
  92.             GradType = {}
  93.             GradType[ App.Constants.GradientType.Linear ] = Linear
  94.             GradType[ App.Constants.GradientType.Rectangular ] = Rectangular
  95.             GradType[ App.Constants.GradientType.Radial ] = Radial
  96.             GradType[ App.Constants.GradientType.Angular ] = Sunburst
  97.             
  98.             CoreName = '%s%s%s' % ( Material[ 'Gradient' ][ 'Name' ], Delimiter, 
  99.                                     GradType[ Material[ 'Gradient' ][ 'GradientType' ] ] )
  100.         elif Material[ 'Art' ]:
  101.             TypeName = Art
  102.             CoreName = '%02x%02x%02x' % Material[ 'Art' ][ 'Color' ]
  103.         else:
  104.             TypeName = Solid
  105.             CoreName = '%02x%02x%02x' % Material[ 'Color' ]
  106.  
  107.         if Material[ 'Texture' ] and Material[ 'Texture' ][ 'Name' ]:
  108.             TextureName = Material[ 'Texture' ]['Name']
  109.  
  110.     if TextureName is not None and IncludeTexture != 0:
  111.         MaterialName = '%s%s%s%s%s' % ( TypeName, Delimiter, CoreName, Delimiter, TextureName )
  112.     else:
  113.         MaterialName = '%s%s%s' % ( TypeName, Delimiter, CoreName )
  114.  
  115.     return MaterialName
  116.  
  117. def IsNullMaterial( Material ):
  118.     ' check if the passed in material is none.  Returns true if null, false if non-null'
  119.     if Material is None:    
  120.         return App.Constants.Boolean.true   # material might be entirely none
  121.  
  122.     ArtIsNone = 0
  123.     ColorIsNone = 0
  124.     GradientIsNone = 0
  125.     PatternIsNone = 0
  126.     
  127.     if Material['Color'] is None:
  128.         ColorIsNone = 1
  129.  
  130.     if Material['Gradient'] is None or Material['Gradient']['Name'] is None:
  131.         GradientIsNone = 1
  132.  
  133.     if Material['Pattern'] is None or \
  134.        (Material['Pattern']['Name'] is None and Material['Pattern']['Image'] is None):
  135.         PatternIsNone = 1
  136.  
  137.     if Material['Art'] is None:
  138.         ArtIsNone = 1
  139.  
  140.     if ColorIsNone and GradientIsNone and PatternIsNone and ArtIsNone:
  141.         return App.Constants.Boolean.true   #it works out to none
  142.     else:
  143.         return App.Constants.Boolean.false
  144.  
  145.  
  146. def IsFlatImage( Environment, Doc ):
  147.     'Determine if Doc consists of a single background layer.  True if flat, false if not'
  148.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  149.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  150.  
  151.     if ImageInfo[ 'LayerNum' ] == 1 and LayerInfo[ 'IsBackground' ] == App.Constants.Boolean.true:
  152.         return App.Constants.Boolean.true
  153.     else:
  154.         return App.Constants.Boolean.false
  155.  
  156. def IsPaletted( Environment, Doc ):
  157.     '''Determine if the current image is paletted.  Greyscale is not counted as paletted
  158.        Returns true on paletted, false if not
  159.     '''
  160.     # these are all the paletted pixel formats
  161.     TargetFormats = [ App.Constants.PixelFormat.Index1, App.Constants.PixelFormat.Index4,
  162.                       App.Constants.PixelFormat.Index8 ]
  163.     
  164.     # are we paletted?
  165.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  166.  
  167.     if Info['PixelFormat'] in TargetFormats:
  168.         return App.Constants.Boolean.true
  169.     else:
  170.         return App.Constants.Boolean.false
  171.  
  172. def IsTrueColor( Environment, Doc ):
  173.     ''' Determine if the current image is true color.  Greyscale does not count
  174.         Returns true for true color, false for all others
  175.     '''
  176.     TargetFormats = [ App.Constants.PixelFormat.BGR, App.Constants.PixelFormat.BGRA ]
  177.     
  178.     # are we true color?
  179.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  180.     if Info['PixelFormat'] in TargetFormats:
  181.         return App.Constants.Boolean.true
  182.     else:
  183.         return App.Constants.Boolean.false
  184.  
  185. def IsGreyScale( Environment, Doc ):
  186.     ' Determine if the current image (not layer) is greyscale. True if it is, false otherwise'
  187.     TargetFormats = [ App.Constants.PixelFormat.Grey, App.Constants.PixelFormat.GreyA ]
  188.     
  189.     # are we true color?
  190.     Info = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  191.     if Info['PixelFormat'] in TargetFormats:
  192.         return App.Constants.Boolean.true
  193.     else:
  194.         return App.Constants.Boolean.false
  195.  
  196. def LayerIsArtMedia( Environment, Doc ):
  197.     'Returns true if the current layer is a artmedia layer'
  198.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  199.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.ArtMedia:
  200.         return App.Constants.Boolean.true
  201.     else:
  202.         return App.Constants.Boolean.false
  203.  
  204. def LayerIsRaster( Environment, Doc ):
  205.     'Returns true if the current layer is a raster layer'
  206.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  207.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Raster:
  208.         return App.Constants.Boolean.true
  209.     else:
  210.         return App.Constants.Boolean.false
  211.  
  212.  
  213. def LayerIsVector( Environment, Doc ):
  214.     'Returns true if the current layer is a vector layer'
  215.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  216.     if LayerInfo[ 'LayerType' ] == App.Constants.LayerType.Vector:
  217.         return App.Constants.Boolean.true
  218.     else:
  219.         return App.Constants.Boolean.false
  220.  
  221. def LayerIsBackground( Environment, Doc ):
  222.     'Returns true if the current layer is the background layer'
  223.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  224.     return LayerInfo[ 'IsBackground' ]
  225.     
  226.  
  227. def GetLayerCount( Environment, Doc ):
  228.     'Returns number of layers in Doc'
  229.     ImageInfo = App.Do( Environment, 'ReturnImageInfo', {}, Doc )
  230.     return ImageInfo[ 'LayerNum' ]    
  231.  
  232. def GetCurrentLayerName( Environment, Doc ):
  233.     'Returns the name of the current layer in Doc'
  234.     LayerInfo = App.Do( Environment, 'ReturnLayerProperties', {}, Doc )
  235.     return LayerInfo[ 'General' ][ 'Name' ]
  236.  
  237. def PromoteToTrueColor( Environment, Doc ):
  238.     'If the current image type is paletted, promote it to true color.  Greyscale is left alone'
  239.     if IsPaletted( Environment, Doc ):
  240.         App.Do( Environment, 'IncreaseColorsTo16Million', {}, Doc )
  241.     return
  242.  
  243. def RequireADoc( Environment ):
  244.     '''Test that we actually have a target document, and put up a message box if we dont
  245.        Returns true if we have an open doc, false otherwise
  246.     '''
  247.     if App.TargetDocument is None:
  248.         App.Do( Environment, 'MsgBox', {
  249.                 'Buttons': App.Constants.MsgButtons.OK, 
  250.                 'Icon': App.Constants.MsgIcons.Stop, 
  251.                 'Text': RequiresOpenImage, 
  252.                 })
  253.         return App.Constants.Boolean.false
  254.     else:
  255.         return App.Constants.Boolean.true
  256.  
  257. # Begin Translatable Strings
  258. # BevelSelection.PspScript:
  259. LayerName_BevelSelection = u"Selecci≤n biselada"
  260.  
  261. # Black and white pencil.PspScript:
  262. LayerName_Blackandwhitepencil = u"Trama 2"
  263.  
  264. # Border with drop shadow.PspScript:
  265. AlphaName = u"Selection #1"
  266.  
  267. # Flag.PspScript:
  268. #AlphaName = u"Selection #1"
  269.  
  270. # Grey chart.PspScript:
  271. GradientName = u"Primer plano-fondo"
  272.  
  273. # Sloppy edges.PspScript:
  274. #AlphaName = u"Selection #1"
  275.  
  276. # Toned greyscale.PspScript:
  277. LayerName_Tonedgreyscale = u"Balance de color 1"
  278.  
  279. # Vignette.PspScript:
  280. LayerName_Vignette = u"Trama 2"
  281.  
  282. # Photo edges.PspScript:
  283. LayerName_Photoedges = u"Trama 2"
  284.  
  285. # SimpleCaption.PspScript:
  286. ImageTooSmallMsg = u"La imagen actual es demasiado peque±a para el tφtulo, debe tener un tama±o mφnimo de 200x200."
  287. MultipleLayersMsg = u"La imagen actual tiene varias capas.  Esto puede originar resultados extra±os.\nSe recomienda aplanar la imagen antes de continuar.  ┐Desea aplanarla?"
  288. CaptionPrompt = u"Inserte un tφtulo para la imagen.  Estarß situado por debajo de la imagen y en el centro."
  289. CaptionTitle = u"Insertar tφtulo de imagen"
  290. PromotedLayerName = u"Imagen"
  291. PageSurfaceLayerName = u"Superficie de la pßgina"
  292. AlbumPageLayerGroup = u"Pßgina de ßlbum"
  293. DropShadowLayerName = u"Aplicar sombra"
  294. CaptionTextLayerName = u"Texto"
  295. CaptionFontName2 = u"Tahoma" 
  296.  
  297. # VectorMergeAndCutoutSelected.PspScript:
  298. TwoOrMoreMsg = u"Esta secuencia de comandos requiere seleccionar uno o dos objetos de vector." 
  299.  
  300. # VectorMergeSelected.PspScript:
  301. #TwoOrMoreMsg = u"This script requires that two or more vector objects be selected."
  302.  
  303. # AddPSP8FileLocations.PspScript:
  304. NoPSP8FoldersFound = u"No se han encontrado carpetas de PSP8."
  305. FilesHaveBeenAdded = u"Los archivos contenidos en '%s' se han agregado a las preferencias de ubicaciones de archivos."
  306. Brushes = u"Pinceles"
  307. BumpMaps = u"Mapas de relieve"
  308. DeformationMaps = u"Mapas de deformaci≤n"
  309. DisplacementMaps = u"Mapas de desplazamiento"
  310. EnvironmentMaps = u"Mapas de entorno"
  311. Gradients = u"Gradientes"
  312. Masks = u"Mßscaras"
  313. Palettes = u"Paletas"
  314. Patterns = u"Patrones"
  315. PictureFrames = u"Marcos de imßgenes"
  316. PictureTubes = u"Tubos de imßgenes"
  317. PresetShapes = u"Formas predefinidas"
  318. Presets = u"Ajustes predefinidos"
  319. PrintTemplates = u"Plantillas de impresion"
  320. QuickGuides = u"Guφas rßpidas"
  321. SampleImages = u"Imßgenes de muestra"
  322. ScriptsRestricted = u"Scripts con limitaciones"
  323. ScriptsTrusted = u"Scripts-De confianza"
  324. Selections = u"Selecciones"
  325. StyledLines = u"Lφneas con estilo"
  326. Swatches = u"Muestras"
  327. Textures = u"Texturas"
  328.  
  329. # AddPSP8FileLocationsALL.PspScript:
  330. #NoPSP8FoldersFound = u"No PSP8 folders found."
  331. #FilesHaveBeenAdded = u"Files in '%s' have been added to the File Locations preferences."
  332. #Brushes = u"Brushes"
  333. #BumpMaps = u"Bump Maps"
  334. #DeformationMaps = u"Deformation Maps"
  335. #DisplacementMaps = u"Displacement Maps"
  336. #EnvironmentMaps = u"Environment Maps"
  337. #Gradients = u"Gradients"
  338. #Masks = u"Masks"
  339. #Palettes = u"Palettes"
  340. #Patterns = u"Patterns"
  341. #PictureFrames = u"Picture Frames"
  342. #PictureTubes = u"Picture Tubes"
  343. #PresetShapes = u"Preset Shapes"
  344. #Presets = u"Presets"
  345. #PrintTemplates = u"Print Templates"
  346. #QuickGuides = u"Quick Guides"
  347. #SampleImages = u"Sample Images"
  348. #ScriptsRestricted = u"Scripts-Restricted"
  349. #ScriptsTrusted = u"Scripts-Trusted"
  350. #Selections = u"Selections"
  351. #StyledLines = u"Styled Lines"
  352. #Swatches = u"Swatches"
  353. #Textures = u"Textures"
  354.  
  355. # CapturePalette.PspScript:
  356. RequiresPaletted = u"Esta secuencia de comandos requiere una imagen de paleta.  ┐Desea disminuir la profundidad de color?"
  357. NoPaletteFound = u"Error interno:  no se han encontrado paletas."
  358. GroutWidthMsg = u"El valor de GroutWidth debe oscilar entre 0 y 20"
  359. ColorsPerRowMsg = u"El valor de ColorsPerRow debe oscilar entre 1 y 100"
  360. TileSizeMsg = u"El valor de TileSize debe oscilar entre 2 y 50"
  361. NumColorsMsg = u"El n·mero de colores debe oscilar entre 2 y 1024"
  362. ButtonMarginMsg = u"El valor de ButtonMargin debe ser inferior a la mitad del valor de TileSize"
  363. ColorIs = u"El color %d es (%02X,%02X,%02X)"
  364.  
  365. # EXIFCaptioning.PspScript:
  366. NoEXIFData = u"No se han encontrado datos de EXIF en la imagen actual."
  367. ExposureMsg = u"f/%g: apertura, %s: exposici≤n"
  368. CaptionBackground = u"Fondo del tφtulo"
  369. EXIFCaption = u"Tφtulo de EXIF"
  370. EXIFText = u"Texto de EXIF"
  371. CaptionFontName = u"Arial"
  372.  
  373. # SplitCMYKtoLayerGroup.PspScript:
  374. Black = u"Negro"
  375. BlackChannel = u"Canal negro"
  376. Yellow = u"Amarillo"
  377. YellowChannel = u"Canal amarillo"
  378. Magenta = u"Magenta"
  379. MagentaChannel = u"Canal magenta"
  380. Cyan = u"Cian"
  381. CyanChannel = u"Canal cian"
  382. CMYKChannels = u"Canales CMYK"
  383.  
  384. # SplitHSLtoLayerGroup.PspScript:
  385. Lightness = u"Luminosidad"
  386. LightnessChannel = u"Canal de luminosidad"
  387. Saturation = u"Saturaci≤n"
  388. SaturationChannel = u"Canal de saturaci≤n"
  389. Hue = u"Matiz"
  390. HueChannel = u"Canal de matiz"
  391. HSLChannels = u"Canales HSL"
  392.  
  393. # SplitRGBtoLayerGroup.PspScript:
  394. Blue = u"Azul"
  395. BlueChannel = u"Canal azul"
  396. Green = u"Verde"
  397. GreenChannel = u"Canal verde"
  398. Red = u"Rojo"
  399. RedChannel = u"Canal rojo"
  400. RGBChannels = u"Canales RGB"
  401.  
  402. # JascUtils.py, PSPUtils.py
  403. SelectionLayer = u"Selecci≤n promovida mediante secuencia de comandos"
  404. Pattern = u"Trama"
  405. Inline = u"Entre lφneas"
  406. Gradient = u"Gradiente"
  407. Linear = u"Lineal"
  408. Radial = u"Radial"
  409. Rectangular = u"Rectangular"
  410. Sunburst = u"Reflejos"
  411. Solid = u"S≤lido"
  412. Null = u"Nulo"
  413. Art = u"Arte"
  414. RequiresOpenImage = u"Esta secuencia de comandos requiere una imagen abierta."
  415. # End Translatable Strings
  416.  
  417.